﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Audit
{
    public class DistributionsParameters
    {
        public Dictionary<DistributionType, Distribution> Distributions { get; set; }

        public DistributionsParameters()
        {
            Distributions = new Dictionary<DistributionType, Distribution>();

            Distributions.Add(DistributionType.CountOfDaysForModelling, new Distribution
            {
                Name = "Количество моделируемых дней",
                Parameters = new List<DistributionsParameter>
                {
                    new DistributionsParameter {Name = "Количество дней", Value = 100},
                }
            });

            Distributions.Add(DistributionType.CountOfOrdersInDay, new Distribution
                                                                       {
                Name = "Количество заказов в день",
                Parameters = new List<DistributionsParameter>
                {
                    //new DistributionsParameter {Name = "n", Value = 15},
                    //new DistributionsParameter {Name = "p", Value = 0.35}
                    new DistributionsParameter {Name = "n", Value = 3},
                    new DistributionsParameter {Name = "p", Value = 0.34}
                }
            });

            Distributions.Add(DistributionType.CountOfChangedOrdersInDay, new Distribution
            {
                Name = "Количество измененных заказов в день",
                Parameters = new List<DistributionsParameter>
                {
                    //new DistributionsParameter {Name = "n", Value = 2},
                    //new DistributionsParameter {Name = "p", Value = 0.2}
                    new DistributionsParameter {Name = "n", Value = 1},
                    new DistributionsParameter {Name = "p", Value = 0.34}
                }
            });


            Distributions.Add(DistributionType.Position, new Distribution
            {
                Name = "Вероятности по продуктам",
                Parameters = new List<DistributionsParameter>
                {
                    new DistributionsParameter {Name = "Вероятность заказа первого продукта", Value = 0.3},
                    new DistributionsParameter {Name = "Вероятность заказа второго продукта", Value = 0.3},
                    new DistributionsParameter {Name = "Вероятность заказа третьего продукта", Value = 0.4}
                }
            });

            Distributions.Add(DistributionType.CountOfPositions, new Distribution
            {
                Name = "Количество позиций в заказе",
                Parameters = new List<DistributionsParameter>
                {
                    new DistributionsParameter {Name = "n", Value = 2},
                    new DistributionsParameter {Name = "p", Value = 0.7}
                }
            });

            Distributions.Add(DistributionType.CountOfProductsInPosition, new Distribution
            {
                Name = "Количество продукта в позиции",
                Parameters = new List<DistributionsParameter>
                {
                    //new DistributionsParameter {Name = "n", Value = 10},
                    //new DistributionsParameter {Name = "p", Value = 0.35}
                    new DistributionsParameter {Name = "n", Value = 1},
                    new DistributionsParameter {Name = "p", Value = 0.35}
                }
            });

            Distributions.Add(DistributionType.StatusOfOrder, new Distribution
            {
                Name = "Статус заказа",
                Parameters = new List<DistributionsParameter>
                {
                    new DistributionsParameter {Name = "Вероятность обычного заказа", Value = 0.6},
                    new DistributionsParameter {Name = "Вероятность срочного заказа", Value = 0.3},
                    new DistributionsParameter {Name = "Вероятность отмены заказа", Value = 0.1}
                }
            });

            Distributions.Add(DistributionType.StatusOfChangeDeliveryMaterial, new Distribution
            {
                Name = "Статус поставки",
                Parameters = new List<DistributionsParameter>
                {
                    //new DistributionsParameter {Name = "Вероятность успешной поставки", Value = 0.8},
                    //new DistributionsParameter {Name = "Вероятность задержки поставки", Value = 0.2}
                    new DistributionsParameter {Name = "Вероятность успешной поставки", Value = 0.999},
                    new DistributionsParameter {Name = "Вероятность задержки поставки", Value = 0.001}
                }
            });

            Distributions.Add(DistributionType.DelayDeliveryMaterial, new Distribution
            {
                Name = "Задержка в днях",
                Parameters = new List<DistributionsParameter>
                {
                    //new DistributionsParameter {Name = "n", Value = 6},
                    //new DistributionsParameter {Name = "p", Value = 0.2}
                    new DistributionsParameter {Name = "n", Value = 1},
                    new DistributionsParameter {Name = "p", Value = 0.001}
                }
            });


        }
    }

    public class Distribution
    {
        public string Name { get; set; }

        public List<DistributionsParameter> Parameters { get; set; }
    }

    public class DistributionsParameter
    {
        public string Name { get; set; }

        public double Value { get; set; }
    }


    public enum DistributionType
    {
        CountOfOrdersInDay,
        CountOfChangedOrdersInDay,
        CountOfProductsInPosition,
        StatusOfOrder,
        StatusOfChangeDeliveryMaterial,
        DelayDeliveryMaterial,
        CountOfPositions,
        Position,
        CountOfDaysForModelling
    }
}
